<include file="Common/nav" current="movie"/>
<div class="container">
  <div class="mycontent">
    <div class="page-header"><h3 class="header-line">{$data.title}</h3></div>
    <div class="row">
      <div class="col-xs-6 col-sm-3">
        <div class="div-thumbnail">
          <img <notempty name="data.poster"> src="{$data.poster}" <else/> data-src="holder.js/220x320" </notempty> alt="{$it.poster}" />
          <div class="caption" style="margin-top:1em;">
            <div class="dl-horizontal">
              <!-- aka -->
              <dt><if condition="in_array('genre',$data['imdb_field'])">
                    <if condition="in_array('genre', $data['dbpedia_field'])"><span class="label label-success pull-left">ID</span>
                    <else/><span class="label label-primary pull-left">IM</span>
                    </if>
                  <else/>
                    <if condition="in_array('genre', $data['dbpedia_field'])"><span class="label label-default pull-left">DB</span>
                    </if>
                  </if>aliases
              </dt>
              <dd>
              <ul class="list-unstyled">
                <?php $_aka = explode(',',$data['aka']); ?>
                <foreach name="_aka" item="it">
                <li>{$it}</li>
                </foreach>
              </ul>
              </dd>
              <!-- rating -->
              <dt><if condition="in_array('rating',$data['imdb_field'])"><span class="label label-primary pull-left">IM</span><else/><span class="label label-default pull-left">DB</span></if>rating</dt>
              <dd>
              <for start="$data['rating']/2|floor" end="0" step="-1" comparison="gt">
              <span class="glyphicon glyphicon-star"></span>
              </for>
              <gt name="data['rating']%2" value="0">
              <span class="glyphicon glyphicon-star-empty"></span>
              </gt>
              {$data.rating}
              </dd>
              <!-- mpaa -->
              <dt><if condition="in_array('mpaa',$data['imdb_field'])"><span class="label label-primary pull-left">IM</span><else/><span class="label label-default pull-left">DB</span></if>mpaa</dt>
              <dd>{$data.mpaa}</dd>
              <!-- genres -->
              <dt><if condition="in_array('genre',$data['imdb_field'])">
                    <if condition="in_array('genre', $data['dbpedia_field'])"><span class="label label-success pull-left">ID</span>
                    <else/><span class="label label-primary pull-left">IM</span>
                    </if>
                  <else/>
                    <if condition="in_array('genre', $data['dbpedia_field'])"><span class="label label-default pull-left">DB</span>
                    </if>
                  </if>genres
              </dt>
              <dd>
              <ul class="list-unstyled">
                <volist name="data.genres" id="it">
                <li><a href="{:U('genre/'.$it['name'])}">{$it.name}</a></li>
                </volist>
              </ul>
              </dd>
              <!-- director -->
              <dt>director</dt>
              <dd><notempty name="data.director"><a href="{:U('person/'.$data['director'][0]['id'])}"}>{$data['director'][0]['name']}</a></notempty>
              <!-- budget -->
              <dt><if condition="in_array('budget',$data['imdb_field'])"><span class="label label-primary pull-left">IM</span><else/><span class="label label-default pull-left">DB</span></if>budget</dt>
              <dd><notempty name="data.budget">{$data['budget']}</a></notempty>
              <!-- country -->
              <dt><if condition="in_array('country',$data['imdb_field'])"><span class="label label-primary pull-left">IM</span><else/><span class="label label-default pull-left">DB</span></if>country</dt>
              <dd>{$data.country}</dd>
              <!-- releasedate -->
              <dt><if condition="in_array('releasedate',$data['imdb_field'])"><span class="label label-primary pull-left">IM</span><else/><span class="label label-default pull-left">DB</span></if>release at</dt>
              <dd><notempty name="data.releasedate">{:strftime('%b %e, %Y', strtotime($data['releasedate']))}</notempty><dd> 
              <!-- runtime -->
              <dt><if condition="in_array('runtime',$data['imdb_field'])"><span class="label label-primary pull-left">IM</span><else/><span class="label label-default pull-left">DB</span></if>runtime</dt>
              <dd>{$data.runtime} min</dt>
              <!-- producedby -->
              <dt><if condition="in_array('producedby',$data['imdb_field'])">
                    <if condition="in_array('producedby', $data['dbpedia_field'])"><span class="label label-success pull-left">ID</span>
                    <else/><span class="label label-primary pull-left">IM</span>
                    </if>
                  <else/>
                    <if condition="in_array('producedby', $data['dbpedia_field'])"><span class="label label-default pull-left">DB</span>
                    </if>
                  </if>producer</dt>
              <dd>
              <ul class="list-unstyled">
                <?php $_producedby = explode(',',$data['producedby']); ?>
                <foreach name="_producedby" item="it">
                <li>{$it}</li>
                </foreach>
              </ul>
              </dd>
            </div>
          </div>
        </div>
      </div>
      <div class="col-xs-12 col-sm-8">
        <ul class="nav nav-tabs" id="mytab">
          <li class="active"><a href="#summary" data-toggle="tab"><b>SUMMARY</b></a></li>
          <li><a href="#person" data-toggle="tab"><b>CAST&CREW</b></a></li>
        </ul>
        <div class="tab-content" id="mytabcontent">
          <div class="tab-pane fade in active" id="summary">
            <h3><b>Summary</b><if condition="in_array('summary',$data['imdb_field'])"><span class="label label-primary pull-right">IM</span><else/><span class="label label-default pull-right">DB</span></if></h3>
            <p>{$data.summary}</p>
          </div>
          <div class="tab-pane fade" id="person">
            <h3><b>Cast&Crew</b></h3>
            <div class="table-responsive">
              <table class="table table-striped table-hover listing-table">
                <tbody>
                <volist name="data.persons" id="it">
                <tr>
                  <td><img class="img-thumbnail" <notempty name="it.poster"> src="{$it.poster}" <else/> data-src="holder.js/80x120" </notempty> style="width:80px;height:120px;"/></td>
                  <td style="vertical-align:middle;"><strong><a href="{:U('person/'.$it['id'])}">{$it.name}</a></strong></td>
                  <td style="vertical-align:middle;">{$it.relation}
                    <if condition="$it['imdb']">
                      <if condition="$it['dbpedia']"><span class="label label-success pull-right">ID</span>
                      <else/><span class="label label-primary pull-right">IM</span>
                      </if>
                    <else/>
                      <if condition="$it['dbpedia']"><span class="label label-default pull-right">DB</span>
                      </if>
                    </if>
                  </td>
                </tr>
                </volist>
                </tbody>
              </table>
            </div>
          </div>
        </div>
        <div class="row" style="margin-top:2em;">
          <h4 style="margin-left:20px;margin-bottom:0.8em;"><em>Related Movies</em></h4>
          <volist name="data.sim_movies" id="it">
          <div class="col-md-3">
            <a href="{:U('movie/'.$it['id'])}" class="thumbnail tool" title="<h5><em>{$it['title']}</em></h5>" data-toggle="tooltip">
              <img <notempty name="it.poster"> src="{$it['poster']}" <else/> data-src="holder.js/140x205" </notempty> style="width:140px;height:205px;"/>
            </a>
          </div>
          </volist>
        </div>
      </div>
    </div>
  </div>
</div>
